<template>
  <div class="img-box" v-if="index == curIndex">
    <img :src="require(`@/assets/images/${imgName}`)" :alt="imgAlt" :title="imgTitle" />
  </div>
</template>

<script>
export default {
  name: 'CardItem',
  props: {
    imgName: String,
    imgAlt: {
      type: String,
      defualt: 'photo',
    },
    imgTitle: {
      type: String,
      defualt: '图片',
    },
    index: [Number, String],
    curIndex: {
      type: [Number, String],
      defualt: 0
    }
  },
};
</script>

<style lang="scss" scoped>
.img-box {
  width: 100%;
  height: 100%;
  img {
    width: 100%;
    height: 100%;
  }
}
</style>
